package metalink.student;

import java.util.ArrayList;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

import model.student.FinanceMo;
import vo.StudentFinancialsVo;

public class ViewAllTransactions extends ActionSupport{
	int year_semester_id = -1,student_id;
	ArrayList<StudentFinancialsVo> list = new ArrayList<StudentFinancialsVo>();

	public String execute() {
		
		HttpSession session;
		session = ServletActionContext.getRequest().getSession();
		student_id=(int) session.getAttribute("user_id");
		System.out.println("in transactions.. student_id= "+student_id);
		setYear_semester_id(year_semester_id);
		setStudent_id(student_id);
		if (year_semester_id == -1) {
			FinanceMo mo = new FinanceMo();
			list = mo.getAllTransactions(student_id);
		} else {
			FinanceMo mo = new FinanceMo();
			list = mo.getSemTransactions(student_id,year_semester_id);
		}
		return SUCCESS;
	}

	public int getYear_semester_id() {
		return year_semester_id;
	}

	public void setYear_semester_id(int year_semester_id) {
		this.year_semester_id = year_semester_id;
	}

	public int getStudent_id() {
		return student_id;
	}

	public void setStudent_id(int student_id) {
		this.student_id = student_id;
	}

	public ArrayList<StudentFinancialsVo> getList() {
		return list;
	}

	public void setList(ArrayList<StudentFinancialsVo> list) {
		this.list = list;
	}
}
